package com.center.growcenterserver.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.center.growcenterserver.common.R;
import com.center.growcenterserver.model.domain.StudentCourse;
import com.center.growcenterserver.model.domain.TeacherCourse;
import com.center.growcenterserver.service.TeacherCoursesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("teachercourses")
public class TeacherCoursesController {

    @Autowired
    TeacherCoursesService teacherCourseService;

    @GetMapping("/{teacherId}/courses")
    public R teacherCoursesById(
            @PathVariable String teacherId,
            @RequestParam(defaultValue = "1") int curPage,
            @RequestParam(defaultValue = "10") int pageSize) {
        IPage<TeacherCourse> page = new Page<>(curPage, pageSize);
        return teacherCourseService.getTeacherCoursesById(teacherId, page);
    }


}
